
import 'dart:async';

import 'package:flutter/services.dart';

class Ht300 {
  static const MethodChannel _channel = MethodChannel('ht300_printer');

  static Future<String?> get platformVersion async {
    final String? version = await _channel.invokeMethod('getPlatformVersion');
    return version;
  }

  ///連接打印機
  static Future<void> connectPrinter({required String ipAddress, required String port}) async {
    await _channel.invokeMethod('connectPrinter', <String, String>{
      'ipAddress': ipAddress,
      'port': port,
    });
  }

  ///斷開打印機
  static Future<void> disconnectPrinter() async {
    await _channel.invokeMethod('disconnectPrinter', <String, String>{});
  }

  ///打印文本
  static Future<void> printText({required String text}) async {
    await _channel.invokeMethod('printText', <String, dynamic>{
      'text': text,
    });
  }


}
